package Demo6;


class Outclass2 {
    public int data1 = 1;
    static int data2 = 2;
    private int data3 = 3;
    static class Inclass2{
        public int data4 = 4;
        static int data5 = 5;
        private int data6 = 6;

        public void test() {
            System.out.println("Inclass2:: test()");
            //静态内部类是禁止访问非静态内部类 /非静态成员的
            //通过外部类类名点成员名来访问
            //如果要访问 需要先实例外部类
            Outclass2 outclass2 = new Outclass2();
            System.out.println(outclass2.data1);
            System.out.println(data2);
            System.out.println(outclass2.data3);
            System.out.println(data4);
            System.out.println(data5);
            System.out.println(data6);
        }
    }

    public void test() {
        System.out.println("Outclass2:: test()");
        System.out.println(data1);
        System.out.println(data2);
        System.out.println(data3);
//        System.out.println(data4);
//        System.out.println(data5);
//        System.out.println(data6);
    }
}
public class Test2 {
    public static void main(String[] args) {
        Outclass2.Inclass2 inclass2 = new Outclass2.Inclass2();
        inclass2.test();
    }
}
